<span page-title ng-model="version">{{ "Remove Version" | translate }} {{ version.version }}</span>

<section>

  <h3 translate>Delete Version {{ version.version }}</h3>

  <div>
    <div bst-alert="warning" ng-hide="allSelectable()">
       <span translate> This Version cannot be deleted from some of the Lifecycle Environments due to one of the reasons below.</span>
       <ul>
         <li translate> No "Promote/Remove" permissions on the Lifecycle Environment.</li>
         <li translate> No "Edit" permissions on some of the Content Hosts in that Lifecycle Environment.</li>
         <li translate> No "Edit" permissions on some of the Activation Keys in that Lifecycle Environment.</li>
       </ul>
    </div>
  </div>

  <p translate>
    Select the Lifecycle Environments you would like to remove Version {{ version.version }} from:
  </p>

  <table bst-table="environmentsTable"
         class="table table-striped table-bordered"
         ng-class="{'table-mask': environmentsTable.working}">
    <thead>
      <tr bst-table-head row-select>
        <th translate>Name</th>
        <th translate>Affected Hosts</th>
        <th translate>Affected Activation Keys</th>
      </tr>
    </thead>

    <tbody>
      <tr ng-show="!environmentsTable.working && environmentsTable.rows.length === 0">
        <td colspan="4" translate>This Version is not associated with any Lifecycle Environments.</td>
      </tr>

      <tr bst-table-row
          row-select="environment"
          ng-repeat="environment in environmentsTable.rows">
        <td>{{ environment.name }}</td>
        <td>{{ environment.host_count }} <span class="note warning" ng-hide="environment.permissions.all_hosts_editable" translate>  (Not all Content Hosts editable )</span></td>
        <td>{{ environment.activation_key_count }} <span class="note warning"  ng-hide="environment.permissions.all_keys_editable" translate>  (Not all Activation Keys editable )</span></td>
      </tr>
    </tbody>

  </table>

  <div>
    <div class="checkbox">
      <div bst-alert="warning" ng-show="deleteOptions.deleteArchive">
        <span translate>Selecting this option will result in the Version being completely deleted and no longer being available for promotion.  The version must be removed from all Lifecycle Environments in order to select this option.</span>
      </div>
      
      <label>
        <input type="checkbox" ng-model="deleteOptions.deleteArchive" ng-disabled="!canDeleteArchive()"/>
        <span translate>Completely remove version?</span>
      </label>
    </div>

    <div class="pull-right">
      <a ui-sref="content-view.versions({contentViewId: contentView.id})" >
        <button type="button" class="btn btn-default" translate>
          Cancel
        </button>
      </a>

      <button type="button" class="btn btn-primary" ng-click="processSelection()" ng-disabled="!anySelectable() || selectionEmpty()" translate>
        Next
      </button>
    </div>
  </div>
</section>
